<template>
    <div >
        <admin-container>
            <template v-slot:content>
             <!--表格  -->
             <table-plugin 
                    :page="page"
                    :config="tableSettings" 
                    :part-operate="partOperate"
                    :search-operate="searchOperate"
                    :global-operate="globalOperate"
                    @part="partOperateActuator"
                    @search="searchOperateActuator"
                    @global="globalOperateActuator"
                    >
                    </table-plugin>
        </template>

        </admin-container>
        
         

    </div>
    
</template>

<script>
import TablePlugin from '@/components/plugs/table-plugin/TablePlugin.vue';
import AdminContainer from '@/components/plugs/admin-container/AdminContainer.vue';

export default {
    data(){
        return{

            page:{},
            tableSettings:{
                router:'/permission/list',
                columns:[
                    {
                        fixed:false,
                        column:'id',
                        name:'权限编号',
                        width:'150',
                        show:false,
                    },
                    {
                        fixed:false,
                        column:'permission',
                        name:'权限标识',
                        width:'150',
                        show:true,
                    },
                    {
                        fixed:false,
                        column:'permissionDesc',
                        name:'权限描述',
                        width:'150',
                        show:true,
                    }
                ]

            },
            partOperate:[
                {type:'update',text:'编辑',level:''},
                {type:'delete',text:'删除',level:'text',color:'red'},
            ],
            globalOperate:{
                left:[
                    {type:'add',text:'添加权限',level:'primary',icon:''},
                    {type:'add',text:'全部删除',level:'warning',icon:''}
                    
                ],
                right:[
                    {type:'add',text:'导入',level:'info',icon:''},
                    {type:'add',text:'导出',level:'success',icon:''},
                    {type:'add',text:'表格设置',level:'',icon:'el-icon-setting'}
                ]
            },
            searchOperate:{
                entity:{

                },
                rules:{
                    id:[
                    { required: true, message: "用户名不能为空~", trigger: 'blur' }
                    ]
                },
                condition:[
                    {label:'编号',prompt:'请输入权限编号',type:'input',width:'150px',name:'id'},
                    {label:'标识',prompt:'请输入权限标识',type:'input',width:'150px',name:'permission'},
                    {label:'描述',prompt:'请输入权限描述(模糊查询)~',type:'input',width:'210px',name:'permissionDesc'},
                    // {label:'描述',prompt:'请输入权限描述(模糊查询)~',type:'input',width:'210px',name:'permissionDesc'},
                    // {label:'描述',prompt:'请输入权限描述(模糊查询)~',type:'input',width:'210px',name:'permissionDesc'},
                  
                ]
            }
        }
    },
    methods:{
        partOperateActuator(index,row,operate){
      
            switch(operate.type){
                case 'update':
                    this.updatePermission(row);
                    break;
                case 'delete':
                    this.deletePermission(row);
            }
            

        },
        globalOperateActuator(entity){
            switch(entity.operate.type){
                case 'add':
                    this.addPermission(entity);
                    break;
            }
            

        },
        searchOperateActuator(page){
            console.log('页码信息',page);
            console.log('搜索条件',this.searchOperate.entity);

        },
        updatePermission(row){
            
        },
        deletePermission(row){

            console.log('我被执行了',row)

        },
        addPermission(entity){
            console.log('添加权限~',entity);

        }
        

    },
    components:{
        'table-plugin':TablePlugin,
        'admin-container':AdminContainer
      
    }

}
</script>

<style scoped>




</style>